package cn.initcap.concurrency.concurrency.synccontainer;

import cn.initcap.concurrency.annoations.ThreadSafe;
import cn.initcap.concurrency.concurrency.ThreadPoolCreatHelper;
import java.util.Vector;
import lombok.extern.slf4j.Slf4j;

/**
 * @author initcap
 * @date Created in 2018/6/16 PM3:38.
 */
@Slf4j
@ThreadSafe
public class VectorExample1 {

    /**
     * 同时并发执行的线程数
     */
    public static final int THREAD_TOTAL = 200;
    /**
     * 总请求数
     */
    private static final int CLIENT_TOTAL = 5000;
    private static Vector<Integer> list = new Vector<>();

    public static void update(int i) {
        list.add(i);
    }

    public static void main(String[] args) throws Exception {
        ThreadPoolCreatHelper.threadFinalCountParam(CLIENT_TOTAL, THREAD_TOTAL,
                VectorExample1.class, "update",
                "VectorExample1");
        log.info("size{}", list.size());
    }

}
